home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / dosrcss.zip / RCSCLEAN.KSH < prev    next >
Text File  |  1990-07-18  |  1KB  |  42 lines

  1. #! /bin/sh
  2. #
  3. # RCS cleanup operation.
  4. # $Header: /site/tmp/dosrcs/src/RCS/rcsclean.ksh,v 1.1 90/07/15 22:57:02 lfk Release $
  5. #
  6. # This program removes working files which are copies of the latest
  7. # revision on the default branch of the corresponding RCS files.
  8. # For each file given, rcsclean performs a co operation for the latest
  9. # revision on the default branch, and compares
  10. # the result with the working file. If the two are identical,
  11. # the working file is deleted.
  12. #
  13. # A typical application in a Makefile would be:
  14. # clean:;       rm *.o; rcsclean *.c *.o
  15. #
  16. # Limitation: This program doesn't work if given the name of
  17. # an RCS file rather than the name of the working file.
  18.  
  19. PATH='/usr/new/bin;/usr/local/bin;/bin;/usr/bin;/usr/ucb'
  20. export PATH
  21.  
  22. progname=$0
  23. if [ $# = 0 ] ; then
  24.     echo        "usage: $progname file ..."
  25.     echo        "removes all working files that are checked in and are unchanged"
  26.     exit  0
  27. fi
  28. TMPFILE=/tmp/rcscl$$.tmp
  29. while test $# -gt 0 ; do
  30.     if test -f $1 ; then
  31.     co -p -q $1 > $TMPFILE
  32.     if [ $? = 0 ] ; then
  33.         cmp -s $1 $TMPFILE
  34.         if [ $? = 0 ] ; then
  35.         chmod +w $1; rm -f $1; rcs -u -q $1
  36.         fi
  37.     fi
  38.     fi
  39.     shift
  40. done
  41. rm -f $TMPFILE
  42.